import Axios from "axios"


export function getPageList(params) {
    return Axios.get('/wosApi/wos/v1/staff/searchPageStaff', {
        params: {
            pageNum: params.currentPage,
            limit: 5
        }
    })

}

export function getOneData(params) {
    return Axios.get('/wosApi/wos/v1/staff/searchOneStaff', {
        params: {
            staffNumber: params.staffNumber
        }
    })

}

export function getList(params) {
    return Axios.get('/wosApi/wos/v1/staff/searchAllStaff', {
        params: {

        }
    })

}

export function getHolidayList(params) {
    return Axios.get('/wosApi/wos/v1/holiday/searchAllHolidayApply', {
        params: {

        }
    })

}

export function getAllSalaryList(params) {
    return Axios.get('/wosApi/wos/v1/salaryPayment/searchAllSalaryRecord', {
        params: {

        }
    })

}

export function getOneSalaryList(params) {
    return Axios.get('/wosApi/wos/v1/salaryPayment/searchOneAllSalaryRecord', {
        params: {
            staffNumber: params.staffNumber,
        }
    })

}


export function getOneScheduleList(params) {
    return Axios.get('/wosApi/wos/v1/schedule/searchOneAllNowSchedule', {
        params: {
            staffNumber: params.staffNumber
        }
    })

}

export function askForHoliday(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);
    formData.append('beginTime', params.beginTime);
    formData.append('endTime', params.endTime);
    formData.append('holidayExplain', params.holidayExplain);

    return Axios.post('/wosApi/wos/v1/holiday/askForHoliday', formData)
}

export function permitOrRejectHoliday(params) {
    var formData = new FormData();
    formData.append('id', params.id);
    formData.append('approval', params.approval);

    return Axios.put('/wosApi/wos/v1/holiday/permitOrRejectHoliday', formData)
}

export function searchOneHolidayRecord(params) {
    return Axios.get('/wosApi/wos/v1/holiday/searchOneHolidayRecord', {
        params: {
            staffNumber: params.staffNumber,
        }
    })
}

export function deleteStaff(params) {
    return Axios.delete('/wosApi/wos/v1/staff/deleteStaff', {
        params: {
            staffNumber: params.staffNumber,
        }
    })
}

export function changeStaff(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);
    formData.append('name', params.name);
    formData.append('sex', params.sex);
    formData.append('department', params.department);
    formData.append('email', params.email);
    formData.append('salary', params.salary);
    formData.append('phoneNumber', params.phoneNumber);
    formData.append('id', params.id);

    return Axios.put('/wosApi/wos/v1/staff/changeStaff', formData)
}

export function changePas(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);
    formData.append('password', params.password);
    formData.append('newPassword', params.newPassword);

    return Axios.put('/wosApi/wos/v1/staff/changeStaffPassword', formData)
}

export function resetPas(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);

    return Axios.put('/wosApi/wos/v1/staff/resetPassword', formData)
}

export function addSta(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);
    formData.append('name', params.name);
    formData.append('password', params.password);
    formData.append('department', params.department);
    formData.append('phoneNumber', params.phoneNumber);
    formData.append('sex', params.sex);
    formData.append('email', params.email);
    formData.append('salary', params.salary);

    return Axios.post('/wosApi/wos/v1/staff/addStaff', formData)
}

export function searchOneReword(params) {
    return Axios.get('/wosApi/wos/v1/salaryReword/searchOneReword', {
        params: {
            staffNumber: params.staffNumber,
        }
    })
}

export function changeSalary(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);
    formData.append('details', params.details);
    formData.append('salaryChange', params.salaryChange);
    formData.append('beginTime', params.beginTime);
    formData.append('endTime', params.endTime);

    return Axios.post('/wosApi/wos/v1/salaryReword/changeSalary', formData)
}

export function changeAllSalary(params) {
    var formData = new FormData();
    formData.append('details', params.details);
    formData.append('salaryChange', params.salaryChange);
    formData.append('beginTime', params.beginTime);
    formData.append('endTime', params.endTime);

    return Axios.post('/wosApi/wos/v1/salaryReword/changeAllSalary', formData)
}

export function paySalary(params) {
    var formData = new FormData();
    formData.append('effectTime', params.effectTime);

    return Axios.post('/wosApi/wos/v1/salaryPayment/paySalary', formData)
}

export function payOneSalary(params) {
    var formData = new FormData();
    formData.append('effectTime', params.effectTime);
    formData.append('staffNumber', params.staffNumber);

    return Axios.post('/wosApi/wos/v1/salaryPayment/payOneSalary', formData)
}

export function selectAllDepartment(params) {
    return Axios.get('/wosApi/wos/v1/staff/selectAllDepartment')
}

export function addSchedule(params) {
    var formData = new FormData();
    formData.append('beginTime', params.beginTime);
    formData.append('endTime', params.endTime);
    formData.append('staffNumbers', params.staffNumbers);
    formData.append('workContents', params.workContents);

    return Axios.post('/wosApi/wos/v1/schedule/addSchedule', formData)
}

export function deleteSchedule(params) {
    var formData = new FormData();
    formData.append('staffNumber', params.staffNumber);
    formData.append('workTime', params.workTime);

    return Axios.post('/wosApi/wos/v1/schedule/deleteSchedule', formData)
}

export function searchSomedaySchedule(params) {
    var formData = new FormData();
    formData.append('searchTime', params.searchTime);

    return Axios.post('/wosApi/wos/v1/schedule/searchSomedaySchedule', formData)
}